package com.issue.system.service.impl;

import java.util.List;
import com.issue.common.utils.DateUtils;
import com.issue.common.utils.SecurityUtils;
import com.issue.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.issue.system.mapper.ChildQuizMapper;
import com.issue.system.domain.ChildQuiz;
import com.issue.system.service.IChildQuizService;

/**
 * QuizService业务层处理
 * 
 * @author system
 * @date 2024-10-20
 */
@Service
public class ChildQuizServiceImpl implements IChildQuizService 
{
    @Autowired
    private ChildQuizMapper childQuizMapper;

    /**
     * 查询Quiz
     * 
     * @param id Quiz主键
     * @return Quiz
     */
    @Override
    public ChildQuiz selectChildQuizById(Long id)
    {
        return childQuizMapper.selectChildQuizById(id);
    }

    /**
     * 查询Quiz列表
     * 
     * @param childQuiz Quiz
     * @return Quiz
     */
    @Override
    public List<ChildQuiz> selectChildQuizList(ChildQuiz childQuiz)
    {
        return childQuizMapper.selectChildQuizList(childQuiz);
    }

    /**
     * 新增Quiz
     * 
     * @param childQuiz Quiz
     * @return 结果
     */
    @Override
    public int insertChildQuiz(ChildQuiz childQuiz)
    {
        childQuiz.setCreateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            childQuiz.setCreateBy(SecurityUtils.getUsername());
        }
        return childQuizMapper.insertChildQuiz(childQuiz);
    }

    /**
     * 修改Quiz
     * 
     * @param childQuiz Quiz
     * @return 结果
     */
    @Override
    public int updateChildQuiz(ChildQuiz childQuiz)
    {
        childQuiz.setUpdateTime(DateUtils.getNowDate());
        childQuiz.setUpdateBy(SecurityUtils.getUsername());
        return childQuizMapper.updateChildQuiz(childQuiz);
    }

    /**
     * 批量删除Quiz
     * 
     * @param ids 需要删除的Quiz主键
     * @return 结果
     */
    @Override
    public int deleteChildQuizByIds(Long[] ids)
    {
        return childQuizMapper.deleteChildQuizByIds(ids);
    }

    /**
     * 删除Quiz信息
     * 
     * @param id Quiz主键
     * @return 结果
     */
    @Override
    public int deleteChildQuizById(Long id)
    {
        return childQuizMapper.deleteChildQuizById(id);
    }
}
